<template>
  <div class="htx-im">
    <el-row :gutter="30">
      <el-col :span="10">
        <el-input v-model="siteId" placeholder="请输入网站id"></el-input>
      </el-col>
      <el-col :span="12">
        <el-button type="primary" plain @click="handleOpenIm">开通 / 关闭</el-button>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      siteId: '',
    };
  },
  methods: {
    handleOpenIm() {
      this.$confirm('是否 开通/关闭 IM即时通讯', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          window.openorcloseIM(this.siteId);
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消',
          });
        });
    },
  },
};
</script>
